/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package csvreader.view;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.JTextField;

/**
 *
 * @author User
 */
public class SearchPanel extends javax.swing.JDialog {

    /**
     * Creates new form searchPanel
     */
    public SearchPanel(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        textFieldCari = new javax.swing.JTextField();
        buttonCari = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(new java.awt.FlowLayout());

        jLabel1.setText("Masukkan Nama");
        getContentPane().add(jLabel1);

        textFieldCari.setPreferredSize(new java.awt.Dimension(120, 20));
        getContentPane().add(textFieldCari);

        buttonCari.setText("Cari");
        buttonCari.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonCariActionPerformed(evt);
            }
        });
        getContentPane().add(buttonCari);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void buttonCariActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCariActionPerformed
        try {
            MainFrame.getMainFrame().getDaoMhs().cariContact(textFieldCari.getText());
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(rootPane, ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
        }
    }

    public JTextField getTextFieldCari() {
        return textFieldCari;
    }//GEN-LAST:event_buttonCariActionPerformed
    /**
     * @param args the command line arguments
     */
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton buttonCari;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JTextField textFieldCari;
    // End of variables declaration//GEN-END:variables
}
